<?php
namespace Admin\Controller;

use Think\Controller;

class CommentController extends Controller
{
    function __destruct(){                                                                         // ��������规��  �����ョ�ㄦ�疯�块��������浣���ュ��
        require '/home/wwwroot/default/world/behavior.php';
    }
    public function ideaManagement()
    {
        $Hint = new \Operation\Controller\HintController();     // 生成操作类对象
        $Hint->checkLogin(3);                                   // 判断是否登录
        $comments = M('comments');
        $ideas    = M('ideas');
        $comment = $comments->where("iid IS NOT NULL")->order("cdate desc")->select();
        for($i = 0;$i<sizeof($comment);$i++){
            $iid = $comment[$i]['iid'];
            $idea = $ideas->where("iid='$iid'")->getField('idea');
            $comment[$i]['idea'] = $idea;
        }
        $this->assign('ideas', $comment);
        $this->display();
    }
    public function deleIdeaManagement()
    {
        $Hint = new \Operation\Controller\HintController();     // 生成操作类对象
        $Hint->checkLogin(3);                                   // 判断是否登录
        $id = $_REQUEST['id'];
        $Management = M('comments');
        $il = $Management->where("cid=$id")->delete();
        if ($il) {
            echo "0";
        } else {
            echo "1";
        }
    }
    public function newsComment(){
        $Hint = new \Operation\Controller\HintController();     // 生成操作类对象
        $Hint->checkLogin(3);                                   // 判断是否登录
        $comments = M('comments');
        $newsComment = $comments->where("iid IS NULL")->select();
        
    }
}
